﻿using Microsoft.EntityFrameworkCore;
using Abp.Zero.EntityFrameworkCore;
using Neocean.Mpa.Authorization.Roles;
using Neocean.Mpa.Authorization.Users;
using Neocean.Mpa.MultiTenancy;
using Neocean.Mpa.MusicStore;
using Neocean.Mpa.EntityFrameworkCore.EntityMapper;

namespace Neocean.Mpa.EntityFrameworkCore
{
    public class MpaDbContext : AbpZeroDbContext<Tenant, Role, User, MpaDbContext>
    {
        /* Define a DbSet for each entity of the application */
        
        public MpaDbContext(DbContextOptions<MpaDbContext> options)
            : base(options)
        {

        }

        public DbSet<Movie> Movies { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            ApplyConfigurationsEntities(modelBuilder);
        }

        private static void ApplyConfigurationsEntities(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new MovieConfiguration());
            //modelBuilder.ApplyConfiguration(new RoleClaimConfiguration());

            //modelBuilder.ApplyConfiguration(new UserConfiguration());
            //modelBuilder.ApplyConfiguration(new UserClaimConfiguration());
            //modelBuilder.ApplyConfiguration(new UserTokenConfiguration());
            //modelBuilder.ApplyConfiguration(new UserRoleConfiguration());
            //modelBuilder.ApplyConfiguration(new UserLoginConfiguration());

        }

    }
}
